package org.aplombh.java.leetcode.all;

public class _26删除有序数组中的重复项 {

}

class Solution26_1 {
    public int removeDuplicates(int[] nums) {

        if (nums.length == 0)
            return 0;

        int i = 1, len = 1;

        while (i < nums.length) {
            if (nums[i] != nums[i - 1]){
                nums[len] = nums[i];
                len++;
            }
            i++;
        }
        return len;
    }
}